<?php
class Silk_Dao_Object extends Doctrine_Record
{

    public function setTableDefinition()
    {
        $this->setTableName('silk_object');
        $this->option('charset', 'utf8');
        $this->option('collate', 'utf8_unicode_ci');
        $this->option('type', 'MyISAM');
        $this->hasColumn('object_id', 'integer', 4, array('type' => 'integer' ,'length' => 4, 'unsigned' => 1, 'primary' => true, 'autoincrement' => true ));
        $this->hasColumn('status', 'string', 255, array('type' => 'string' ,'length' => 255 ));
        $this->hasColumn('slug', 'string', 255, array('type' => 'string' ,'length' => 255 ));
        $this->hasColumn('name', 'string', 255, array('type' => 'string' ,'length' => 255 ));
        $this->hasColumn('content', 'clob', null, array('type' => 'clob' ));
        $this->hasColumn('mimetype', 'string', 255, array('type' => 'string' ,'length' => 255 ));
        $this->hasColumn('revision', 'integer', 4, array('type' => 'integer' ,'length' => 4 ));
        $this->hasColumn('site_id', 'integer', 4, array('type' => 'integer' ,'length' => 4 ));
        $this->hasColumn('user_id', 'integer', 4, array('type' => 'integer' ,'length' => 4 ));
        $this->hasColumn('type_id', 'integer', 4, array('type' => 'integer' ,'length' => 4 ));
        $this->hasColumn('parent_id', 'integer', 4, array('type' => 'integer' ,'length' => 4 ));
        $this->hasColumn('route', 'string', 255, array('type' => 'string' ,'length' => 255 ));
    }

    public function setUp()
    {
        $this->actAs('Timestampable');

// 	$this->hasOne('FP_Dao_User as Owner', array( 'local' => 'user_id', 'foreign' => 'user_id'  ) );

        $this->hasOne('Silk_Dao_Site as Site', array( 'local' => 'site_id', 'foreign' => 'site_id'  ) );
        $this->hasOne('Silk_Dao_Type as Type', array( 'local' => 'type_id', 'foreign' => 'type_id'  ) );
        $this->hasOne('Silk_Dao_Object as Parent', array( 'local' => 'parent_id', 'foreign' => 'object_id'  ) );
        $this->hasMany('Silk_Dao_Meta as Metas', array(  'local' => 'object_id', 'foreign' => 'object_id'  ) );
        $this->hasMany('Silk_Dao_Translation as Translations', array(  'local' => 'object_id', 'foreign' => 'object_id'  ) );
        $this->hasMany('Silk_Dao_Object as Children', array(  'local' => 'object_id', 'foreign' => 'parent_id'  ) );
        $this->hasMany('Silk_Dao_TermTaxonomy as TermTaxonomies', array( 'refClass' => 'Silk_Dao_ObjectTermTaxonomy',  'local' => 'object_id', 'foreign' => 'term_taxonomy_id'  ) );
    }


}

 ?>